function ImgCell = genLHPairs(ImgPath, scale, idx, cmap)

if nargin < 3, idx = []; end
if nargin < 4, cmap = 'gray'; end

if isempty(strfind(ImgPath, filesep)) % ~isdir(ImgPath)
    ImgPath = srpath.getDataPath(ImgPath);
end

if ~isempty(idx) && (ischar(idx) || iscell(idx))
    gen_pairs(idx);
    return
end

ImgFiles = srimg.dirimgs(ImgPath, true);
if ~isempty(idx), ImgFiles = ImgFiles(idx); end
gen_pairs(ImgFiles);

    function gen_pairs(ImgFiles)
        if ischar(ImgFiles), ImgFiles = {ImgFiles}; end
        
        ImgNum = length(ImgFiles);
        ImgCell = cell(ImgNum, 3);
        for i = 1 : ImgNum
            %% read ground truth image
            y0 = srimg.imread(fullfile(ImgPath, ImgFiles{i}), scale, cmap);
            
            %% bicubic interpolation
            [yhat, x] = srimg.im2lr(y0, scale, 'bicubic');
            
            ImgCell(i, :) = {x, yhat, y0};
        end
    end
end